package cn.yajienet.data.elasticsearch.annotation;


import cn.yajienet.data.elasticsearch.document.DefaultInitializeDocument;
import cn.yajienet.data.elasticsearch.document.InitializeDocument;
import cn.yajienet.data.elasticsearch.enums.Dynamic;
import cn.yajienet.data.elasticsearch.mapping.AutoMapping;
import cn.yajienet.data.elasticsearch.mapping.Mapping;
import cn.yajienet.data.elasticsearch.setting.DefaultSetting;
import cn.yajienet.data.elasticsearch.setting.Setting;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @Author Wang Chenguang
 * @Email wcg.chen@foxmail.com
 * @Date on 2021/10/16
 * @Version 1.0.0
 * @Description  elasticsearch 文档
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Document {

    /**
     * 默认类名，规则：首字母大写转小写，除首字母大写转小写并在大写字母前加“-”
     *
     * @author Wang Chenguang
     * @date 2021/12/19
     */
    String index() default "";

    /**
     * 默认类名，规则：首字母大写转小写，除首字母大写转小写并在大写字母前加“-”
     *
     * @author Wang Chenguang
     * @date 2021/12/19
     */
    String alias() default "";

    /**
     * mapping则又可以分为动态映射（dynamic mapping）和静态（显式）映射（explicit mapping）和精确（严格）映射（strict mappings），具体由dynamic属性控制
     */
    Dynamic dynamic() default Dynamic.TRUE;

    Class<? extends Setting> setting() default DefaultSetting.class;

    Class<? extends Mapping> mapping() default AutoMapping.class;

    Class<? extends InitializeDocument> initializeDocument() default DefaultInitializeDocument.class;

}
